﻿using System;
using UnityEngine;
using UnityEngine.UI;

public class EditIconWidget : MonoBehaviour
{
    public RawImage iconImg;

    Tex m_Tex;

    public Action<Texture2D> onEditEnd;

    //Texture2D texture;

    void Start()
    {

    }

    public void OnClickLoadImage()
    {
        EditPhotoItem.LoadImg((newtexture) =>
        {
            //iconImg.texture = texture;

            onEditEnd?.Invoke(newtexture);
            //m_Tex = new Tex(texture.EncodeToJPG(80), texture.width, texture.height);
        });
    }

    public void OnClickSkip()
    {
        onEditEnd?.Invoke(null);
    }

    void OnDestroy()
    {
        //if (texture != null)
        //    Destroy(texture);
    }
}
